const env = process.env;

const app = {
  host: env.HOST,
  port: env.PORT,
}

// 数据库设置
const database = {
  url: env.DB_URL,
  db_name: env.DB_NAME
}

// 日志
const log = {
  console: env.NODE_ENV !== 'production',
  file: `${__dirname}/../logs/log.log`, //此处设置log文件输出路径
  //logrotator设置按什么归档日志
  logrotator: {
    byDay: true,
    dayDelimiter: '_'
  },
  maxBufferLength: 4096,
  flushInterval: 1000,
  //自定义level设置输出所有级别日志
  customLevels: 'all',
  //prettyPrint自定义日志输出格式，colorize设置为false为不显示颜色，防止日志文件出现 [32m 乱码
  prettyPrint: {
    colorize: false,
    timestampKey: 'time',
    translateTime: 'yyyy-mm-dd HH:MM:ss.l',
    messageFormat: '{msg}'
  }
}


module.exports = {
  app,
  database,
  log
}